package com.xinqing.test.LetCode;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * @Author:CHQ
 * @Date:2021/7/21 9:58
 * @Description
 */
public class KthLargest {
    public static void main(String[] args) {

        System.out.println(add(8, new int[]{1, 5, 6, 7, 3}, 2));


    }



    public static int add(int val,int[] nums,int k){

        ArrayList<Integer> list=new ArrayList<>();
        list.add(val);

        for(int x:nums){
            list.add(x);
        }

        Object[] res=list.toArray();

        Arrays.sort(res);

        return (int)res[res.length-k];
    }
}
